home *** CD-ROM | disk | FTP | other *** search
/ Directorty Opus 5 - Magellan 2 / Opus 5 - Magellan 2.iso / Extras / DOpus-1541 / REXX / DOPUS / 1541 / 1541Format.rexx < prev    next >
OS/2 REXX Batch file  |  1995-02-24  |  2KB  |  85 lines

  1. /*
  2.  *
  3.  * Format a 1541 disk from DOpus.
  4.  *
  5.  * (c) 1995 by Christer Bjarnemo  mr.bjarnemo@mn.medstroms.se
  6.  *
  7.  * Based on Twin-Dopus by Patrick Van Beem (patrick.van.beem@aobh.xs4all.nl),
  8.  * which based he's script on the DOpusLhaARexx package by Geoff Seeley.
  9.  *
  10.  */
  11.  
  12. dircmd = "Work:Emulators/A64/Utils/"    /* Note. If the file ENVARC:1541.PREFS */
  13. rxdir =  "Rexx:Dopus/1541/"             /* exists, that one will override the  */
  14. tmpdir = "t:"                           /* settings here...                    */
  15. DOpusPort   = 'DOPUS.1'
  16.  
  17. snuff = '22'x
  18.  
  19. if open(1,'env:1541.prefs','Read') then do
  20.         dircmd = readln(1)
  21.     rxdir  = readln(1)
  22.         tmpdir = readln(1)
  23.     address command 'type 'tmpdir'_64dir.tmp'
  24.         end
  25. close(1)
  26.  
  27. dircmd = slashpath(dircmd)
  28. rxdir =  slashpath(rxdir)
  29. tmpdir = slashpath(tmpdir)
  30.  
  31. if ~show(l,"rexxsupport.library") then        
  32.     call addlib("rexxsupport.library",0,-30,0)
  33. if showlist('Ports', DOpusPort) = 0 then do
  34.    say 'Directory Opus Arexx port not found. Aborting.'
  35.    call CleanUp
  36. end
  37.  
  38. address(DOpusPort)
  39. options results
  40.  
  41. /* setup DOpus window and tell user what's happening */
  42. Busy on
  43. TopText "Format a 1541-disk..."
  44.  
  45. Request 'Warning! You are going to FORMAT the disk in your 1541 diskdrive!'
  46. if result = 0 then call cleanup
  47.  
  48. Getstring '"Enter a name for the 1541 disk" "Diskname,ID"'
  49.  
  50. dname = lower(result)
  51.  
  52. address command dircmd'64Cmd >'tmpdir'1541.tmp "n:'dname'" 8'
  53.  
  54. if open(1,tmpdir'1541.tmp','Read') then do
  55.         Do for 8 ; tmp = readln(1) ; End
  56.     say tmp
  57.     Toptext tmp
  58.         close(1)
  59.         end
  60.    address arexx rxdir'1541Dir.rexx'
  61. exit
  62.  
  63. /*---------------------------------------------------------------------------*/
  64.  
  65. CleanUp: /* Remove any files and exit */
  66.    Busy off
  67.    exit
  68. return
  69.  
  70.  
  71. Lower: procedure /* Convert string to lowercase */
  72.    parse arg string
  73.    string = TRANSLATE(string, xrange('a', 'z'), xrange('A','Z'))
  74. return string
  75.  
  76.  
  77. /*---------------------------------------------------------------------------*/
  78. Slashpath: procedure /* Put a (/) or (:) at the end of filenames (if neccessary) */
  79. parse arg string
  80.     if right(string,1) ~= ':' & right(string,1) ~= '/'  then do
  81.         string = string'/'
  82.         end
  83. return string
  84.  
  85.